ref: Properly type tracing channels#1517
Merged
Luca Forstner (lforst) merged 7 commits intomainfrom Mar 11, 2026
Merged
Conversation
Comment on lines
+20
to
+21
| name: string; | ||
| fullName: string; |
There was a problem hiding this comment.
Why do we have both name and fullName? Can't we derive one from the other?
Member
Author
There was a problem hiding this comment.
It's very valid you bring this up cause this I was the most hesitant with.
It's either:
- You provide the short form, ie
chat.completions.createand we prefix it withorchestrion:openai:, which is a bit tricky because orchestrion decides by itself what the{pkg}inorchestrion:{pkg}:would be. - We provide the long form, ie
orchestrion:openai:chat.completions.create, but then we have to dynamically strip away theorchestion:openai:prefix which I found a bit nasty too
So my through process was: Screw it, providing both is not too hard and also leaves very little room for (runtime) error.
There was a problem hiding this comment.
Maybe we can have a defineChannels API that looks like so?
export function defineChannels<T extends Record<string, { channelName: string; kind: ChannelKind }>>(
pkg: string,
specs: T,
): { [K in keyof T]: TypedChannel<...> } {
return Object.fromEntries(
Object.entries(specs).map(([key, spec]) =>
[key, channel({
...spec,
fullChannelName: `orchestrion:${pkg}:${spec.channelName}`,
})]
)
);
}export const openAIChannels = defineChannels("openai", {
chatCompletionsCreate: { channelName: "chat.completions.create", kind: "async" },
});
Member
Author
There was a problem hiding this comment.
I like that
Member
Author
There was a problem hiding this comment.
implemented
9566be5 to
2300966
Compare
Closed
6 tasks
88a83a1 to
22cd406
Compare
Abhijeet Prasad (AbhiPrasad)
approved these changes
Mar 11, 2026
Member
Abhijeet Prasad (AbhiPrasad)
left a comment
There was a problem hiding this comment.
nice! the type safety feels way better
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR adds a type system to the plugins so that we have e2e typed tracing channels. This should allow us to hopefully migrate the rest of the wrappers to diagnostics channels more easily and safely.
defineChannelshelper that allows for configuring a list of channels that can be passed directly as a generic type to the base plugindefineChannelsfunction exposes the channels as fields which in return exposetracingChannel()andtracePromise()as helper functions to emit tracing events. These functions are fully typed and compatible with the plugins if the type is passed in properly.Closes #1502